The BioDT Recreational Potential Model for Scotland

Technical Supplement

Authors
Affiliation

Joe Marsh Rossney

UK Centre for Ecology & Hydrology

Maddalena Tigli

Chris Andrews

Jan Dick

Simon Rolph

Published

June 30, 2025

Modified

June 21, 2025

Abstract

This supplement provides technical details about the Recreational Potential model. This includes a mathematical description of the model, details regarding the source data, and technical aspects of the code.

1 Technical description of the model

While there have been several publications citing the RP model, so far none have included a detailed technical description of the model itself.

1.1 Presence/absence rasters

We begin by defining some notation.

Let \(I : \mathbb{R}^2 \to \{0, 1\}\) be a binary-valued function that maps pairs of coordinates \(x \equiv (x_1, x_2) \in \mathbb{R}^2\) to either \(0\) or \(1\). This is a mathematical representation of a single raster layer in a ‘one-hot’ representation, where a value of \(I(x) = 1\) indicates presence of a feature at the coordinate \(x\), and \(I(x) = 0\) indicates absence.

The RP model currently includes 87 features/items grouped into four components (see Section 3). Each of these has its own presence/absence raster. We will therefore introduce two subscript indices and write each layer as \(I_{ij}(x)\), where

  • \(i \in \{1, 2, 3, 4\}\) labels the component to which \(I_{ij}\) belongs, as specified in Table 1, and
  • \(j \in \{1, 2, \ldots, n_i\}\) labels the item/feature within that component, of which there are \(n_i\).

As a concrete example, if \(j=1\) labels the ‘pond’ item, then \(I_{41}(x)\) takes a value of \(1\) whenever there is a pond at \(x\), and a value of \(0\) elsewhere.

\(i\) Component Short code
1 Landscape SLSRA
2 Natural Features FIPS_N
3 Infrastructure FIPS_I
4 Water Water
Table 1: Integer label and short-code for the four components of the RP model

1.2 Proximity contributions

For certain features like rivers and lakes it does not make sense to restrict their contributions to the Recreational Potential to the pixels in which they are present. One does not need to be standing in a lake to appreciate it!1

It makes sense to attempt to account for the presence of these features nearby.

Let \(\mathcal{P}_{ij} \subset \mathbb{R}^2\) denote the set of coordinates in which the feature \((ij)\) is present, i.e.2

\[ \mathcal{P}_{ij} := \left\{ x' \in \mathbb{R}^2 \mid I_{ij}(x') = 1 \right\} \, . \tag{1}\]

We first compute a ‘distance raster’ in which each pixel is assigned a value that is the (Euclidean) distance to the nearest pixel in which the feature \((ij)\) is present,

\[ d_{ij}(x) = \min_{x'\in \mathcal{P}_{ij}} \lVert x - x' \rVert_2 \, , \tag{2}\]

where \(\lVert x - x' \rVert_2 = \sqrt{(x_1 - x'_1)^2 + (x_2 - x'_2)^2}\).

These distances must be mapped to the unit interval \([0, 1]\) such that \(0 \mapsto 1\) and \(\infty \mapsto 0\), i.e. so that presence of the feature in this pixel results in the highest value of \(1\), tailing off to \(0\) when the feature is very far away.

There are many different ways to achieve this. Following Paracchini et al. (2014, 374 – Eq. 1), the function chosen is a smooth, monotonically decreasing function in the logistic family,

\[ u(d_{ij}(x) \,; \alpha, \kappa) = \frac{\kappa + 1}{\kappa + \exp(\alpha \, d_{ij}(x))} \, . \tag{3}\]

It remains to specify values for the parameters \(\kappa\) and \(\alpha\), the latter of which is most important since it determines the rate at which the value of \(u\) declines as the distance to the nearest feature increases.

The parameters chosen in the original version of this code were3

\[ \kappa = 6 \, , \qquad \alpha = 0.01011 \, , \tag{4}\]

resulting in a function, Figure 1, that halves at \(d\approx200\) (metres) and drops to \(0.1\) at \(d\approx400\).4 At this distance, features with a user-provided score of \(10\) (i.e. the highest) would be equivalent to a local feature given a score of \(1\) (the lowest). It is safe to assume that at distances greater than this the contribution from the feature would be indiscernible to the user.

Code
alpha <- 0.01011
kappa <- 6
logistic_func <- function(d) {
    (kappa + 1) / (kappa + exp(alpha * d))
}

d <- seq(0, 500, by = 1)
u <- logistic_func(d)

plot(d, logistic_func(d), ylim=c(0, 1), type="l", lwd=2,
    xlab=expression("d"), ylab=expression("u(d, alpha, kappa)"))
Figure 1: A plot of the function which maps positive distances to the unit interval.

1.3 Calculation of a single component

As mentioned previously, there are 87 features in total, each of which corresponds to (a) persona score between \(0\) and \(10\),

\[ \rho_{ij} \in \{0, 1, \ldots, 10\} \, , \tag{5}\]

and (b) a raster layer \(f_{ij}(x)\). For the landscape and natural features components (i.e. \(i = 1,2\)) the feature rasters are precisely the binary presence/absence rasters discussed previously,

\[ f_{ij}(x) = I_{ij}(x) \, , \qquad i = 1, 2 \, . \tag{6}\]

For the infrastructure and water components (\(i=3, 4\)) the features rasters contain the proximity contributions described above,

\[ f_{ij}(x) = u(d_{ij}(x) \,; \alpha, \kappa) \, , \qquad i = 3, 4 \, . \tag{7}\]

Each component is calculated as a simple weighted sum of the features contained within it,

\[ F_i(x \,; \rho_i) = \sum_{j=1}^{n_i} \rho_{ij} f_{ij}(x) \, , \tag{8}\]

where we have permitted \(\rho_i\) to denote the set of persona scores \(\{\rho_{i1}, \rho_{i2}, \ldots, \rho_{i n_i} \}\) for the \(i\)-th component.

1.4 Domain-dependent rescalings

Let \(F \vert_{\mathcal{R}}\) denote the restriction of a function \(F\) to a subdomain \(\mathcal{R} \subset \mathbb{R}^2\) which defines the ‘region of interest’ in which we wish to compute Recreational Potential. We now define a family of rescaled functions,

\[ \hat{F}(x \,; \mathcal{R}) := \frac{F(x) - \min F \big\vert_{\mathcal{R}}}{\max F \big\vert_{\mathcal{R}} - \min F \big\vert_{\mathcal{R}}} \, , \tag{9}\]

each of which corresponds to a particular choice of restriction, i.e. a particular region of interest.

Assuming that \(F(x)\) is not a constant function on \(\mathcal{R}\),5 these rescaled functions are ‘normalised’ to the unit interval within the region of interest, i.e. 

\[ \min_{x\in\mathcal{R}} \hat{F}(x \,; \mathcal{R}) = 0 \, , \qquad \max_{x\in\mathcal{R}} \hat{F}(x \,; \mathcal{R}) = 1 \, . \tag{10}\]

It is important to be aware that with this approach to rescaling introduces a dependence on the region of interest. That is,

\[ \hat{F}(x \,; \mathcal{R}_1) \neq \hat{F}(x \,; \mathcal{R}_2) \, . \tag{11}\]

Thus, the RP value at any given pixel should be expected to change when a different area is selected, even if the persona and the input data stays the same.

1.5 Calculation of Recreational Potential

To compute the Recreational Potential value, the four rescaled components are summed,

\[ F_{\mathrm{RP}}(x \,; \rho, \mathcal{R}) = \sum_{i=1}^4 \hat{F}_i(x \,; \rho_i , \mathcal{R}) \, , \tag{12}\]

and rescaled \(F_{\text{RP}} \longrightarrow \hat{F}_\text{RP}\) using Equation 9 once more (with the same \(\mathcal{R}\)) so that the result falls in the interval \([0, 1]\).

2 Production of input rasters

The data production, or raster pre-processing stage refers to the production of the rasters that are directly multiplied by the persona scores in the dynamic part of the model. That is, the output of this stage is four multi-layered rasters \((f_1, f_2, f_3, f_4)\) corresponding to the four components, where \(f_i := (f_{i1}, f_{i2}, \ldots, f_{i n_i})\), whose individual layers \(f_{ij}\) are defined by Equation 6 (for \(i = 1, 2\)) and Equation 7 (for \(i=2,3\)).

The process of producing these rasters is currently split into two distinct parts:

  1. A manual part in which categorical rasters are constructed from raw downloaded datasets using QGIS
  2. A scripted part in which these categorical rasters are converted into the form required by the model, using R.

The scripted part is executed by running inst/scripts/data_production/main.R (or the containerised version) with the manually-produced categorical rasters already present. This script mostly just calls functions defined in R/data_production.R.

2.1 Data sources

Name Description Attribute statement Conditions of use Data Owner/IPR Version Access via
Scotland Boundary Shapefile of the Scotland boundary - NUTS level1 Contains public sector information licensed under the Open Government Licence v3.0. Contains OS data © Crown copyright and database right 2024 Freely available for any use (public domain or CC0) UK Govt. Jan-18 https://geoportal.statistics.gov.uk/datasets/e9cfbf2e478a481bb367eb2f2891d504_0/about
Core paths network FIPS_I: shapefile containing the core path network Contains public sector information licensed under the Open Government Licence v3.0. NA Improvement Service 15/02/2024 https://data.spatialhub.scot/dataset/core_paths-is
Roads FIPS_I: Shapefile contains road types Contains Ordnance Survey data licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Ordnance Survey (OS) Oct-23 https://osdatahub.os.uk/downloads/open/OpenRoads
Tracks FIPS_I: Shapefile containing road types within OpenStreetMap (OSM) filtered for tracks. Map data copyrighted OpenStreetMap contributors and available from https://www.openstreetmap.org Freely available for any use (public domain or CC0) Ordnance Survey (OS) NA https://www.openstreetmap.org
National Cycle Network FIPS_I: shapefile containing the National Cycle Network Contains public sector information licensed under the Open Government Licence v3.0. NA NA 18-Feb-24 https://data-sustrans-uk.opendata.arcgis.com/
Landform classes from Scotland Soil Map (FIPS_N): A shapefile containing polygons of the soil types and landorm at a 250k:1 scale National Soil Map of Scotland v1.4 copyright and database right The James Hutton Institute 2024. Used with the permission of The James Hutton Institute. All rights reserved. Any public sector information contained in these data is licensed under the Open Government Licence v.2.0 Freely available with obligation to quote the source James Hutton Institute 1.4 https://spatialdata.gov.scot/geonetwork/srv/eng/catalog.search#/metadata/B7E65842-C041-4950-BF0C-3AF06C2DBAE7
Slope (FIPS_N): Created from Copernicus GLO-30 Digital Elevation Model European Space Agency, Sinergise (2021). Copernicus Global Digital Elevation Model. Distributed by OpenTopography. https://doi.org/10.5069/G9028PQB. Accessed: 2024-02-15 Freely available with obligation to quote the source ESA 01/01/2011 - 07/01/2015 https://portal.opentopography.org/raster?opentopoID=OTSDEM.032021.4326.3
Soilclasses from Scotland Soil Map (FIPS_N): A shapefile containing polygons of the soil types and landorm at a 250k:1 scale National Soil Map of Scotland v1.4 copyright and database right The James Hutton Institute 2024. Used with the permission of The James Hutton Institute. All rights reserved. Any public sector information contained in these data is licensed under the Open Government Licence v.2.0 Freely available with obligation to quote the source James Hutton Institute 1.4 https://spatialdata.gov.scot/geonetwork/srv/eng/catalog.search#/metadata/B7E65842-C041-4950-BF0C-3AF06C2DBAE7
Spatial inventory of UK waterbodies (Water - Lakes): Contains data supplied by UK Centre for Ecology & Hydrology licensed under the Open Government Licence v3.0. Freely available with obligation to quote the source UKCEH v3.6 https://ckan.publishing.service.gov.uk/dataset/spatial-inventory-of-uk-waterbodies
OS Open Rivers (Water - Rivers): Contains Ordnance Survey data licensed under the Open Government Licence v3.0. Freely available with obligation to quote the source Ordnance Survey (OS) 2.3 - (04/2023) https://osdatahub.os.uk/downloads/open/OpenRivers
Land Cover Map SLSRA: EUNIS L2 Raster containing pixels of land cover habitat type Maps and data created by Space Intelligence with input and support from NatureScot , © SNH Freely available with obligation to quote the source UKCEH 2022 https://spatialdata.gov.scot/geonetwork/srv/api/records/8462f345-6e9c-45de-b1d2-665a55b9d74a
NNR SLSRA: Shapefile containing areas designated as NNR Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 24/07/2023 https://opendata.nature.scot/
National Parks SLSRA: Shapefile containing Scotlands National Parks © Scottish Government, contains Ordnance Survey data © Crown copyright and database right 2024. Freely available for any use (public domain or CC0) Scottish Govt. 20/02/2023 https://hub.arcgis.com/datasets/ScotGov::national-parks-scotland/about
NR SLSRA: Shapefile containing areas designated as Nature Reserves Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 24/07/2023 https://opendata.nature.scot/
Regional Park SLSRA: Shapefile containing areas designated as Regional Park Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 24/07/2023 https://opendata.nature.scot/
RSPB Reserves SLSRA: Shapefile containing RSPB reserves Data reproduced with the permission of RSPB.   © Crown Copyright. Ordnance Survey licence number 100021787 (2024) Freely available with obligation to quote the source RSPB NA https://opendata-rspb.opendata.arcgis.com/datasets/6076715cb76d4c388fa38b87db7d9d24/explore?location=56.545680%2C-2.668597%2C7.67
SAC SLSRA: Shapefile containing areas designated as Special Areas of Convervation (SAC) Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 29-Aug-23 https://opendata.nature.scot/
SPA SLSRA: Shapefile containing areas designated as SPA Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 24/07/2023 https://opendata.nature.scot/
SSSI SLSRA: Shapefile containing areas designated as SSSI Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 15/02/2024 https://opendata.nature.scot/
SWT Reserves SLSRA: Shapefile containing Scottish Wildlife Trust (SWT) reserves Scottish Wildlife Trust Freely available with obligation to quote the source Scottish Wildlife Trusts NA https://scottishwildlifetrust.org.uk/our-work/our-evidence-base/our-data/
Wildland SLSRA: Shapefile containing areas designated as Wildland Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 2014 (24/7/2024) https://opendata.nature.scot/
CountryParks SLSRA: Shapefile containing areas designated as CountryParks Contains public sector information licensed under the Open Government Licence v3.0. Freely available for any use (public domain or CC0) Nature Scot 24/07/2023 https://opendata.nature.scot/
High Nature Value (HNV) farmland SLSRA: Shapefile containing HNV farmland land parcels N/A available via EEA data portal under open access (ODC-by) Freely available for any use (public domain or CC0) EEA 2012 accounting version, Nov. 2017 https://www.eea.europa.eu/en/datahub/datahubitem-view/1bd26e8f-8ea0-45e0-b6bf-9ed2baff5d28?activeAccordion=1070000%2C61

2.2 Manipulation in QGIS

2.2.1 Landscape component

TO DO

2.2.2 Natural Features component

The 24 features in this component are grouped into three main categories: Landform (16 features), Slope (6 features), and Soil (2 features)

Landform features

The landform data was extracted from the Scotland 250K Soils Map (CHRIS add APA citation). The following methodologies were applied:

  1. Initial dissolve: the dataset was “dissolved” in QGIS using the Landform field, reducing it to 334 unique polygon features.

  2. Grouping: the 334 landform types were manually grouped into 16 broader categories based on descriptive keywords (e.g. “hills”, “foothills” etc…). (Chris can you confirm they were 16 and not 17? For transparency and reprodcucibility, a table in the appending mapping the original attributes to the grouped category would be ideal)

  3. Final dissolve and resterization: The grouped dataset was dissolved again to generate one polygon per broad category. Finally, the data-sets was converted into raster format at a 20 m x 20 m resolution, with each layer corresponding to one of the 16 landform categories.

Slope features

Slope data were derived from the Copernicus GLO-30 Digital Elevation Model (DEM), a global 30 m resolution dataset (CHRIS add APA citation and confirm resolution). The following methodologies were applied:

  1. Slope calculation: the DEM the elevation data were converted into slopes using QGIS (chris, was this using GDAL in its default setting?).

  2. Reclassification: The continuous slope values were re-classified into six slopes classes (which form the six slope features) (see Table X). (Chris were this category picked by you or do they come from somewhere? I think we need to specify this)

Slopes categories used to reclassify the Copernicus GLO-30 Digital Elevation Model (DEM) data into the 6 “slope” features of the Natural Features component of the RP model.
Slope (%) Slope description
<3 easy
3-5 gentle slope
5-10 medium slope
10-20 steep slope
20-30 very steep slope
>30 extremely steep slope
  1. Upsampling: The slope raster was upsampled to a 20m x 20m resolution in QGIS.
    (do you know which method was used to interpolate?) (was the raster first up-sampled to 20m x 20 m and then the slope calculated or the opposite?)
Soil features

The ==landform data was extracted from the Scotland 250K Soils Map== (APA citation). The following methodologies were applied:

  1. Initial dissolve: The dataset was “dissolved” by field “genSoilTyp” in QGIS, reducing it to 12 unique attribute values (12 soil types).

  2. Grouping: These were manually grouped into 2 soil categories: orgnaic (peat) and mineral. (chris, table with what soil type was assigned to each group).

  3. Final dissolve and rasterization: The grouped dataset was dissolved again to the new soil type. Finally, the data-sets was converted into raster format at a 20 m x 20 m resolution.

2.2.3 Infrastructure Features component

The infrastructure component (FIPS_I.tif) is derived from a raster indicating the presence/absence or vicinity to 10 infrastructure features. The file for this component is derived through a three-step process:

To begin with, a raster with a value of 1 for cells where the features is present, and 0 or NAs for the cells where the feature is absent. The 10 features are grouped into three main categories: “Roads Tracks” (5 features), “Cycle Network” (4 features), and Local Path Network” (1 feature):

Roads and Tracks

Road Tracks data was sourced from the OS OpenRoads dataset (add citation). The following methodologies were applied:

  1. Initial dissolve: the dataset was “dissolved” in QGIS using the by the “Road type” field, reducing it to XX unique polygon features (.

  2.   “Tracks” were extracted from OSM_Roads datasets then merged with the attribute field “Access Roads” in the OpenRoads dataset to create the attribute value “Access roads / Tracks”.

Cycle network

Sustrans National Cycle Network dataset were initially dissolved by two attribute fields  “Desc_” & “Surface” in QGIS.  A new attribute field was created taking the attribute value from “Desc_” (on road / off road) and suffixing with grouped surface types (paved or unpaved).

2.2.4 Water component

The water component is derived from a raster indicating the presence or absence of infrastructure features. This original raster, labeled “original” in the Easter Bush example map, contains: 1 for cells where the feature is present, and 0 or NAs for cells where the feature is absent.

The water component is derived from:

Rivers

Os Open Rivers dataset was reduced from 74997 features, by dissolved by attribute fields “name” and “Region” so that all river segments were joined by a common name. To avoid rivers with the same name but located in different areas being incorrectly joined, “Region” from the OS Boundaries dataset was merged with the OS Open Rivers prior to this step. To reduce the dataset into something scoreable at a national scale, it was decided to use a proxy for river size/regional importance.  This is a subjective process, decided on by the research team.  Seven classes were created and dataset features classified based on either the attribute “form” which was a descriptor for water type, or keywords in the attribute “name” (see table for examples), or researcher knowledge of major rivers of national and regional importance.

Water rivers classification
Class Example search terms or process
Major river or tributary Specific e.g. “Tay”, “Spey” etc.
Tidal river or estuary taken from dataset attribute “form”
Minor river or tributary e.g. “River”, “Abhainn”, “Uisge”
Named minor stream or tributary e.g. “Allt”, “Alltan”, “Burn”, “Feadan”, “Sruth”, “Caochan”
Unnamed minor stream or tributary e.g. “Allt”, “Alltan”, “Burn”, “Feadan”, “Sruth”, “Caochan”
Canal taken from dataset attribute “form”
Lake taken from dataset attribute “form”
Lakes

The Spatial inventory of UK waterbodies dataset contained 25404 features for Scotland.  To make it into a relevant and scorable dataset it was reduced to six features based on the given size (in hectares) of a waterbody using the attribute “Poly_Area_Ha”.  Classification was as follows:

water lakes
Class size (ha)
Pond \(<0.2\)
Lochan \(0.2-2\)
Small loch \(2-10\)
Mediun loch \(10-100\)
Large loch \(100-500\)
Major loch \(>500\)

2.3 Quantising the slope raster

With one exception, every raster layer produced by the manual process is an integer-valued categorical raster. The single exception is a ‘slope’ raster containing the average absolute gradient \(s(x)\) within each pixel.

We use terra::classify to quantise this continuous range into six categories according to their steepness,

\[ C_{\text{slope}}(x) = \begin{cases} 1 & &0 \leq s(x) < 1.72 \\ 2 & &1.72 \leq s(x) < 2.86 \\ 3 & &2.86 \leq s(x) < 5.71 \\ 4 & &5.71 \leq s(x) < 11.31 \\ 5 & &11.31 \leq s(x) < 16.7 \\ 6 & &16.7 \leq s(x) \, . \end{cases} \tag{13}\]

==TODO: Why are these intervals different from the ones above?==

2.4 Reprojection

The categorical rasters produced in the previous stage do not necessarily share the exact same coordinate grid. They can be coerced to share the same grid using terra::project.

We projected all rasters onto a reference raster with the following properties:

  • Coordinate reference system (CRS): EPSG:27700 (British National Grid)
  • Resolution: 20 metres x 20 metres
  • Extent: \((x_\text{min}, x_\text{max}, y_\text{min}, y_\text{max}) = (-10000, 660000, 460000, 1220000)\), which is a rectangular box around Scotland.

We used the ‘nearest’ interpolation mode (method="near") since the data is categorical. The reprojected rasters therefore contain the same set of integer values as the original rasters.

2.5 Conversion to one-hot representation

The next stage converts the categorical rasters (\(C_i(x) \in \{0, 1, \ldots, n_i\}\) into a set of presence/absence rasters for each feature. These binary-valued rasters are referred to as the one-hot representation of the data.

Consider the following categorical raster,

\[ C_i = \begin{bmatrix} \ddots \\ & 1 & 0 & 0 \\ & 2 & 1 & 0 \\ & 2 & 1 & 3 & \\ & & & & \ddots \end{bmatrix} \, . \tag{14}\]

The one-hot encoding of this raster is written

\[ C_i \overset{\text{one hot}}{\longrightarrow} ( I_{i0}, I_{i1}, I_{i2}, I_{i3}, \ldots) \, , \tag{15}\]

where the binary-valued presence/absence rasters are, in this case,

\[ \begin{align} I_{i0} &= \begin{bmatrix} \ddots \\ & 0 & 1 & 1 \\ & 0 & 0 & 1 \\ & 0 & 0 & 0 & \\ & & & & \ddots \end{bmatrix} \, , \quad I_{i1} = \begin{bmatrix} \ddots \\ & 1 & 0 & 0 \\ & 0 & 1 & 0 \\ & 0 & 1 & 0 & \\ & & & & \ddots \end{bmatrix} \, , \\ I_{i2} &= \begin{bmatrix} \ddots \\ & 0 & 0 & 0 \\ & 1 & 0 & 0 \\ & 1 & 0 & 0 & \\ & & & & \ddots \end{bmatrix} \, , \quad I_{i3} = \begin{bmatrix} \ddots \\ & 0 & 0 & 0 \\ & 0 & 0 & 0 \\ & 0 & 0 & 1 & \\ & & & & \ddots \end{bmatrix} \, . \end{align} \tag{16}\]

The implementation of this step involves the use of terra::lapp to parallelise the calculation over the spatial domain. In practice we use NA instead of 0 to denote absence.

one_hot_pixel <- function(x) {
    out <- matrix(0, nrow = length(x), ncol = length(feature_mapping))
    for (i in seq_along(feature_mapping)) {
        out[, i] <- ifelse(x == as.numeric(feature_mapping[i]), 1, NA)
    }
    return(out)
}

layer <- terra::lapp(
    layer,
    fun = one_hot_pixel,
    filename = outfile,
    overwrite = TRUE,
    wopt = list(
        names = names(feature_mapping),
        datatype = "INT1U"
    )
)
1
Take a single pixel value (x) of a single-layered raster and return the one-hot representation at that point, i.e. a vector of n_i values of which up to one is 1 (present) and the remainder are NA (absent).
2
Apply this function in a vectorised fashion to every pixel of the input faster.
3
Write the outputs to outfile as they are computed, to reduce memory requirements.

2.6 Stacking into component rasters

This stage is nothing more than combining many single-layered rasters files into a single multi-layered raster for each component. Roughly speaking, we do

# Construct a list of rasters from each .tif file in `infiles`
rasters <- lapply(infiles, terra::rast)

# Construct a single multi-layered raster from this list
stacked <- terra::rast(rasters)

# Re-apply layer names
layer_names <- unlist(lapply(rasters, names))
names(stacked) <- layer_names

# Write the combined raster to disk
terra::writeRaster(stacked, outfile)

Note that terra::rast(rasters) does not preserve layer names when rasters is a list of rasters, hence the need for the two lines prior to writeRaster.

A warning about layer names

It is very unfortunate that the names we have used for the layers follow the same format (filename_i for integers i) as the names that are automatically generated by terra::rast. Because of this, if these two lines that re-apply layer names are omitted, it is not obvious that anything is wrong; no error will be thrown and one can go onto compute RP values, since the names are as expected.

However, the results will be wrong, since terra::rast will apply the right names in the wrong order.

Future developers are strongly recommended to fix this problem by using different layer names. This issue and suggested solutions are discussed in depth in the Developers’ Report.

2.7 Proximity contributions

This stage applies Equation 2 and Equation 3 to each layer of the Infrastructure and Water components.

In fact Equation 2 is the most challenging computation in the whole processing pipeline, due to the fact that its memory requirements scale poorly with the size of the input raster.

Every single other processing step is entirely local; all of the information required to generate an output value for a pixel at coordinate \(x\) is contained in the input pixels at coordinate \(x\). This makes it trivial to process the data in chunks, and memory costs scale linearly with the area of the chunks.

In contrast, calculating distance to the nearest feature is strongly non-local; the output value at \(x\) is a function of the full set of input values. Naively, the entire raster must be loaded to compute the output at a single location.

To perform this calculation we used terra::distance. It is not necessarily true that the underlying C++ implementation of GDALComputeProximity, which is called by terra::distance, actually loads the entire raster into memory immediately. However, for Scotland at 20 metre resolution, we found that the memory requirements for this distance calculation (several 10s of GB) surpass the typical memory available on a standard personal computer by an order of magnitude.

To get around this issue, the original Scotland-wide raster was divided into 20 overlapping spatial ‘windows’. Note that the size of the overlap needed to be at least as large as the effective cutoff distance of 500m. After the distance step was complete within each window, the windows were stitched together, discarding the overlaps.

The distance raster was also truncated at 500m, setting any values above this to NA which simply passes through the function applying Equation 3 and ensures that we don’t waste disk space storing high-precision floats that are functionally equivalent to zero.

2.7.1 Visual demonstration

TODO: Madda - make this figure static for pdf?

To account for proximity effects, the distance from each cell to the nearest infrastructure feature was calculated using the terra::distance() function in R. The resulting raster, labeled “distance” in the example map, contains the distance in meters from the center of each cell to the nearest feature. This raster is named “scored” in the example map, using the distance decay function.

3 List of items/features

Here we list the full set of 87 items/features that make up the layers of the input rasters, and must be scored by the user to construct a persona.

Component Short code Num. layers Description
Landscape SLSRA 40 Land cover type, landscape designations and conservation, and farmland of high nature value.
Natural Features FIPS_N 24 Landform types, soil types and slope.
Infrastructure FIPS_I 10 Roads, tracks, footpaths and cycle networks.
Water Water 13 Lakes and rivers.

3.1 Landscape component

Name Description
SLSRA_CP_2 Country Park
SLSRA_HNV_2 Designated High Nature Value (HNV) farmland
SLSRA_LCM_1 Alpine and subalpine grassland
SLSRA_LCM_2 Arable land and market gardens
SLSRA_LCM_3 Arctic, alpine and subalpine scrub
SLSRA_LCM_4 Bare field or exposed soil
SLSRA_LCM_5 Base-rich fens and calcareous spring mires
SLSRA_LCM_6 Broadleaved deciduous woodland
SLSRA_LCM_7 Built-up area
SLSRA_LCM_8 Coastal dunes and sandy shore
SLSRA_LCM_9 Coastal shingle
SLSRA_LCM_10 Dry grassland
SLSRA_LCM_11 Freshwater
SLSRA_LCM_12 Inland cliffs, rock pavements and outcrops
SLSRA_LCM_13 Lines of trees, small planted woodlands, early-stage woodland and coppice
SLSRA_LCM_14 Littoral sediment or saltmarsh
SLSRA_LCM_15 Mesic grassland
SLSRA_LCM_16 Mixed deciduous and coniferous woodland
SLSRA_LCM_17 Non-native coniferous plantation
SLSRA_LCM_18 Raised and blanket bog
SLSRA_LCM_19 Riverine and fen scrubs
SLSRA_LCM_20 Rock cliffs, ledges and shores
SLSRA_LCM_21 Scots pine woodland
SLSRA_LCM_22 Screes
SLSRA_LCM_23 Seasonally wet and wet grassland
SLSRA_LCM_24 Temperate montane scrub
SLSRA_LCM_25 Temperate shrub heathland
SLSRA_LCM_26 Valley mires, poor fens and transition mires
SLSRA_LCM_27 Windthrown woodland
SLSRA_LCM_28 Woodland fringes and clearings and tall forb stands
SLSRA_NNR_2 National Nature Reserve (NNR)
SLSRA_NP_2 National Park
SLSRA_NR_2 Nature Reserve
SLSRA_RP_2 Regional Park
SLSRA_RSPB_2 Royal Society for the Protection of Birds (RSPB) Reserve
SLSRA_SAC_2 Special Area of Conservation (SAC)
SLSRA_SPA_2 Special Protection Area (SPA)
SLSRA_SSSI_2 Site of Special Scientific Interest (SSSI)
SLSRA_SWT_2 Scottish Wildlife Trust Reserve
SLSRA_WLA_2 Wild Land Areas
Table 2: Description of items/features in the Landscape component.
Tip

The interactive version of this document contains maps that allow you to toggle individual layers.

3.2 Natural Features component

Name Description
FIPS_N_Landform_1 Foothills
FIPS_N_Landform_2 Mountains
FIPS_N_Landform_3 Terraces
FIPS_N_Landform_4 Flood plain
FIPS_N_Landform_5 Beaches or Dunes
FIPS_N_Landform_6 Rocks or Scree
FIPS_N_Landform_7 Depressions
FIPS_N_Landform_8 Hills
FIPS_N_Landform_9 Lowlands
FIPS_N_Landform_10 Rock Walls
FIPS_N_Landform_11 Uplands
FIPS_N_Landform_12 Valley sides
FIPS_N_Landform_13 Valley bottom
FIPS_N_Landform_14 Built-up areas
FIPS_N_Landform_15 Saltings
FIPS_N_Landform_16 Hummocks, mounds or moraines
FIPS_N_Slope_1 No slope
FIPS_N_Slope_2 Gentle slope
FIPS_N_Slope_3 Medium slope
FIPS_N_Slope_4 Steep slope
FIPS_N_Slope_5 Very steep slope
FIPS_N_Slope_6 Extremely steep slope
FIPS_N_Soil_1 Peat or Organic
FIPS_N_Soil_2 Mineral
Table 3: Description of items/features in the Natural Features component.

3.3 Infrastructure Features component

Name Description
FIPS_I_LocalPathNetwork_2 Path
FIPS_I_RoadsTracks_4 Minor or local road
FIPS_I_RoadsTracks_2 A Road
FIPS_I_RoadsTracks_1 Motorway
FIPS_I_RoadsTracks_5 Access roads or Track
FIPS_I_RoadsTracks_3 B Road
FIPS_I_NationalCycleNetwork_1 On Road: Paved Surface
FIPS_I_NationalCycleNetwork_2 Traffic Free: Unpaved Surface
FIPS_I_NationalCycleNetwork_3 Traffic Free: Paved Surface
FIPS_I_NationalCycleNetwork_4 On Road: Unpaved Surface
Table 4: Description of items/features in the Infrastructure Features component.

3.4 Water component

Name Description
Water_Lakes_1 Pond
Water_Lakes_2 Lochan
Water_Lakes_3 Small Lochs
Water_Lakes_4 Medium Lochs
Water_Lakes_5 Large Lochs
Water_Lakes_6 Major Lochs
Water_Rivers_1 Minor river or tributary
Water_Rivers_2 Unnamed minor stream or tributary
Water_Rivers_3 Major river or tributary
Water_Rivers_4 Named minor stream or tributary
Water_Rivers_5 Lake
Water_Rivers_6 Tidal river or estuary
Water_Rivers_7 Canal
Table 5: Description of items/features in the Water component.

Access to code & data

Code for the Recreational Potential model is available as an R Package hosted on GitHub at https://github.com/BioDT/uc-ces-recreation. These reports relate specifically to the version 1.0 release, which is also available on Zenodo at https://doi.org/10.5281/zenodo.15705544.

The model requires some input data that is too large to be bundled in with the package, but which can be downloaded from Dropbox after package installation using biodt.recreation::download_data(). This data is also included in the Zenodo listing.

The source for these documents and this website can be found at https://github.com/BioDT/ces-recreation-reports.

Funding

Funding for OpenNESS came from the European Community’s Seventh Framework Programme (FP7/2007-2013) under grant agreement no 308428, OpenNESS Project (Operationalisation of Natural Capital and Ecosystem Services: From Concepts to Real-world Applications.)

Funding for BioDT came from the European Union’s Horizon Europe Research and Innovation Programme under grant agreement No 101057437 (BioDT project, https://doi.org/10.3030/101057437). Views and opinions expressed are those of the author(s) only and do not necessarily reflect those of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them.

Funding for SPEAK came from the Natural Environment Research Council – Growing Shoots Partnership and application co-creation bursary. NE/Y005805/1 _Growing Shoots.

CRediT statement

JMR and MT developed the current version of the model, and wrote the original drafts of these reports. CA obtained the input data and developed the previous version of the model. CA and JD conceptualised the SPEAK project and carried out the ananalysis. CA, JD and SR acquired funding for the project under BioDT.

Acknowledgements

We wish to acknowledge significant contributions to a previous version of the Recreational Potential model by Will Bolton. JMR would also like to thank Tomáš Martinovič for assisting with understanding the requirements of BioDT.

We are very grateful to all the participants of the SPEAK project which this output is based on including: Alastair Leaver, Alice MacSporran, Brian Cassidy, Chris Pollock, David Giles, Jean Cowie, Joanna Gilliatt, Justyna Olszewska, Laura Taylor, Maddi Bunker, Rebecca MacLennan, S Mayes, Shaila Rao, Steve MacKinnon and Tom Gebbie, Active Stirling. We are equally grateful to an additional 18 participants who preferred to remain anonymous.

Correspondence

  • {jand,chan}@ceh.ac.uk for enquiries relating to the BioDT or SPEAK projects, or ongoing and future work.

  • chan@ceh.ac.uk for enquiries relating to the data sources and QGIS processing.

  • {joemar,madtig}@ceh.ac.uk for enquiries relating to the code and anything else appearing in the technical supplement and/or developer’s report.

  • simrol@ceh.ac.uk for enquiries relating to the biodiversity component of the BioDT project.

References

Paracchini, Maria Luisa, Grazia Zulian, Leena Kopperoinen, Joachim Maes, Jan Philipp Schägner, Mette Termansen, Marianne Zandersen, Marta Perez-Soba, Paul A. Scholefield, and Giovanni Bidoglio. 2014. “Mapping Cultural Ecosystem Services: A Framework to Assess the Potential for Outdoor Recreation Across the EU.” Ecological Indicators 45 (October): 371–85. https://doi.org/10.1016/j.ecolind.2014.04.018.

Footnotes

  1. Indeed this is true for almost every type of feature, but these proximity contributions were only computed for roads/paths and water features.↩︎

  2. The right-hand-side of Equation 1 can be read as “The set of all 2d coordinates \(x'\) for which the condition \(I_{ij}(x') = 1\) is satisfied.”↩︎

  3. The provenance of these values, which date back to the earliest version of the code, has been lost. The precision with which \(\alpha\) is given is a particular curiosity.↩︎

  4. Note that this does not exhibit the classic ‘S’ shape of logistic curves since the domain is restricted to the positive real line (distances are non-negative!).↩︎

  5. If \(F(x)\) is constant in the region of interest then the right-hand-side of Equation 9 diverges and \(\hat{F}\) is undefined.↩︎

Reuse

Citation

BibTeX citation:
@report{ukceh2025,
  author = {Marsh Rossney, Joe and Tigli, Maddalena and Andrews, Chris
    and Dick, Jan and Rolph, Simon},
  title = {The {BioDT} {Recreational} {Potential} {Model:} {Technical}
    {Reports}},
  date = {2025-06},
  url = {https://biodt.github.io/ces-recreation-reports},
  doi = {nora-doi},
  langid = {en},
  abstract = {These reports describe the BioDT Recreational Potential
    Model for Scotland (1.0), at the end of the BioDT project in June
    2025.}
}
For attribution, please cite this work as:
Marsh Rossney, Joe, Maddalena Tigli, Chris Andrews, Jan Dick, and Simon Rolph. 2025. “The BioDT Recreational Potential Model: Technical Reports.” NERC Open Research Archive. https://doi.org/nora-doi.